<include file="Index/header" />
    <!--sidebar left start-->
    <include file="Index/nav" />
    <!--左侧栏 end-->
    <!--主内容 start-->
    <section class="main-content-wrapper">
        <section id="main-content">
            
            <div class="row">
                    <div class="col-md-12">
                        <div class="panel panel-default">
                            <div class="panel-heading">
                                <h3 class="panel-title">写心晴</h3>
                                <div class="actions pull-right">
                                    <i class="fa fa-chevron-down"></i>
                                    <i class="fa fa-times"></i>
                                </div>
                            </div>
                            <div class="panel-body"> 
                            	<form class="form-horizontal form-border" id="cs_content_form">
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">标题</label>
                                        <div class="col-sm-6">
                                            <input type="text" name="title" class="form-control" placeholder="文章标题">
                                        </div>
                                    </div>
                                    
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">内容</label>
                                        <div class="col-sm-6">
                                            <input type="text" name="txt" class="form-control" placeholder="文章短标题">
                                        </div>
                                    </div>
                                    
                                	<div class="form-group">
                                    	<label class="col-sm-3 control-label">缩略图</label>
                                    	<div class="col-sm-6">
		                                    <input type="file" class="layui-upload-file" name="suosuo"  id="file_upload" /><br />
		                                    <div id="upload_img_show" style="display: none;  background-repeat: no-repeat; width: 200px; height: 200px;background-image: url(); background-color: #D0D2D0;text-align: center;;margin-top: 10px;background-position: center;background-size: 100% auto;">
		                                   		 <p id="upload_tips" style="color: #ff0000;position: absolute; margin-top:80px; width: 200px; background-color: rgba(192,152,89,0.6);padding: 10px 0;">上传中</p>
		                                    </div>
		                                    <input type="hidden" name="thumb" id="file_upload_img" value="" multiple="true" />
	                                    </div>
                                	</div>
                                   
                                    
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label">发布状态</label>
                                        <div class="col-sm-6">
                                            <div class="radio">
                                                <input class="icheck" type="radio" checked="" name="status" value="1">
                                                <label>立即发布</label>
                                            </div>
                                            <div class="radio">
                                                <input class="icheck" type="radio" name="status" value="0">
                                                <label>草稿箱</label>
                                            </div>
                                        </div>
                                    </div>
                                    
                                    
                                    <input type="hidden" name="auth_name" class="form-control" value="<?php echo$_SESSION['adminUser']['username'];?>">
                                	
                                    <div class="form-group">
                                        <label class="col-sm-3 control-label"></label>
                                        <div class="col-sm-6">
	                                        <button type="button" id="csbtn_content_sub" class="btn btn-primary">提交</button>
                                        </div>
                                    </div>
                                    
                                    
                                </form>
								
                            </div>
                        </div>
                    </div>
                </div>
          
            
        </section>
    </section>
    <!--主内容区 end-->
    <script src="/Public/js/admin/content.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript">
    	var SCOPE={
			'add_url':'/admin.php?c=Mood&a=add',
			'check_url':'/admin.php?c=Mood&a=check',
			'del_url':'/admin.php?c=Mood&a=del',
			'jump_url':'/admin.php?c=Mood&a=index',
			'listorder_url':'/admin.php?c=Mood&a=listorder',
			'ajax_upload_img_url':'/admin.php?c=image&a=save',
		}
    	
    	
    	$(function  () {
    		
    		
    		
			layui.upload({
				url:  SCOPE.ajax_upload_img_url,
				method : 'post',
				type : 'images',
				ext: 'jpg|png|gif|psd',
				title : '上传图片',
				before : function(input){
					$('#upload_img_show').show();
					console.log($(input).val());
					var $file = $(input);
					var fileObj = $file[0];
					var windowURL = window.URL || window.webkitURL;
					var dataURL;
					var $img = $("#upload_img_show");
					 
					if(fileObj && fileObj.files && fileObj.files[0]){
					dataURL = windowURL.createObjectURL(fileObj.files[0]);
					var bgurl = "url('"+dataURL+"')";
					$img.css({"background-image":bgurl});
					}
					
				},
				success: function(res, input){
					 var bgurl = "url('"+res.suosuo.url+"')";
					 console.log(bgurl);
					 $("#upload_tips").html("上传完成!");
					 $("#upload_tips").css({'color':'#fff'});
					 $('#file_upload_img').val(res.suosuo.url);
				}
			});
    	});
    </script>
        
<include file="Index/footer" />